package com.example.forum.controller;


import com.example.forum.MyQuery;
import com.example.forum.entity.TAppuser;
import com.example.forum.service.ITAppuserService;
import com.example.forum.service.ITBlockareaService;
import com.example.forum.service.impl.TAppuserServiceImpl;
import com.example.forum.vo.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author why
 * @since 2020-04-22
 */
@RestController
@RequestMapping("Block")
public class TBlockController extends BaseController{

    @Autowired
    ITBlockareaService blockareaService;

    @Autowired
    ITAppuserService appuserService;

    @GetMapping("GetBlockList")
    public JsonResult getBlockList(){
        TAppuser appuser = appuserService.getById(currentUserId());
        if (appuser==null) {
            return new JsonResult(HttpStatus.INTERNAL_SERVER_ERROR,"用户不存在",null);
        }
        return new JsonResult(HttpStatus.OK,"",blockareaService.getBlockList(appuser));
    }
}
